#ifndef __LIGHT_COMMAND_LIST_H__
#define __LIGHT_COMMAND_LIST_H__
#include <ltPtcParse.h>

#if DEVICE_PLATFORM_CONFIGURE != DEVICE_PLATFORM_C51_MCU
#pragma pack(1)
#endif
// =============command rwSn(write or read serial number) begin=====================
typedef struct
{
    char wSn[LT_CMD_SN_MAX_SIZE];
} ltCmdStcSnd_rwSn;
typedef struct
{
    char rSn[LT_CMD_SN_MAX_SIZE];
} ltCmdStcResp_rwSn;
typedef union
{
    ltCmdStcSnd_rwSn idt;
    ltCmdStcResp_rwSn odt;
} ltCmdUnion_rwSn;
void ltCmdFuncOvtSnd_rwSn(ltCmdStcSnd_rwSn *idt);
void ltCmdFuncOvtResp_rwSn(ltCmdStcResp_rwSn *odt);
#if LT_PTC_CMD_SUB_ENABLE
void ltCmdFuncSubDo_rwSn(ltCmdUnion_rwSn *iodt, ltPtcParseStc *ptcptr);
#endif
#if LT_PTC_CMD_HOST_ENABLE
int ltCmdFuncHostPack_rwSn(ltPtcParseStc *ptcptr, int packAddr, int packCrypt, ltCmdStcSnd_rwSn *packDt);
int ltCmdFuncHostDoResp_rwSn(ltCmdStcResp_rwSn *odt, ltPtcParseStc *ptcptr);
#endif
// =============command rwSn(write or read serial number) end======================

// =============command rwAddr(write or read address) begin=====================
typedef struct
{
    char cfgSn[LT_CMD_SN_MAX_SIZE];
    uint8_t rwflag; // 0:read; 1:write
    uint8_t wAddr;  // write addr
} ltCmdStcSnd_rwAddr;
typedef struct
{
    uint8_t rAddr; // read addr
} ltCmdStcResp_rwAddr;
typedef union
{
    ltCmdStcSnd_rwAddr idt;
    ltCmdStcResp_rwAddr odt;
} ltCmdUnion_rwAddr;
void ltCmdFuncOvtSnd_rwAddr(ltCmdStcSnd_rwAddr *idt);
void ltCmdFuncOvtResp_rwAddr(ltCmdStcResp_rwAddr *odt);
#if LT_PTC_CMD_SUB_ENABLE
void ltCmdFuncSubDo_rwAddr(ltCmdUnion_rwAddr *iodt, ltPtcParseStc *ptcptr);
#endif
#if LT_PTC_CMD_HOST_ENABLE
int ltCmdFuncHostPack_rwAddr(ltPtcParseStc *ptcptr, int packAddr, int packCrypt, ltCmdStcSnd_rwAddr *packDt);
int ltCmdFuncHostDoResp_rwAddr(ltCmdStcResp_rwAddr *odt, ltPtcParseStc *ptcptr);
#endif
// =============command rwAddr(write or read address) end======================

// =============command getInf begin=====================
typedef struct
{
    char dlgKey[16];
} ltCmdStcSnd_getInf;
typedef struct
{
    uint16_t dlgcrc;
    char rvers[30];
    char rsn[LT_CMD_SN_MAX_SIZE];
} ltCmdStcResp_getInf;
typedef union
{
    ltCmdStcSnd_getInf idt;
    ltCmdStcResp_getInf odt;
} ltCmdUnion_getInf;
void ltCmdFuncOvtSnd_getInf(ltCmdStcSnd_getInf *idt);
void ltCmdFuncOvtResp_getInf(ltCmdStcResp_getInf *odt);
#if LT_PTC_CMD_SUB_ENABLE
void ltCmdFuncSubDo_getInf(ltCmdUnion_getInf *iodt, ltPtcParseStc *ptcptr);
#endif
#if LT_PTC_CMD_HOST_ENABLE
int ltCmdFuncHostPack_getInf(ltPtcParseStc *ptcptr, int packAddr, int packCrypt, ltCmdStcSnd_getInf *packDt);
int ltCmdFuncHostDoResp_getInf(ltCmdStcResp_getInf *odt, ltPtcParseStc *ptcptr);
#endif
// =============command getInf end======================

// =============command heartBeat begin=====================

typedef struct
{
    char resvSnd[16];
} ltCmdStcSnd_heartBeat;
typedef struct
{
    char resvResp[16];
} ltCmdStcResp_heartBeat;
typedef union
{
    ltCmdStcSnd_heartBeat idt;
    ltCmdStcResp_heartBeat odt;
} ltCmdUnion_heartBeat;
void ltCmdFuncOvtSnd_heartBeat(ltCmdStcSnd_heartBeat *idt);
void ltCmdFuncOvtResp_heartBeat(ltCmdStcResp_heartBeat *odt);
#if LT_PTC_CMD_SUB_ENABLE
void ltCmdFuncSubDo_heartBeat(ltCmdUnion_heartBeat *iodt, ltPtcParseStc *ptcptr);
#endif
#if LT_PTC_CMD_HOST_ENABLE
int ltCmdFuncHostPack_heartBeat(ltPtcParseStc *ptcptr, int packAddr, int packCrypt, ltCmdStcSnd_heartBeat *packDt);
int ltCmdFuncHostDoResp_heartBeat(ltCmdStcResp_heartBeat *odt, ltPtcParseStc *ptcptr);
#endif
// =============command heartBeat end======================

#if DEVICE_PLATFORM_CONFIGURE != DEVICE_PLATFORM_C51_MCU
#pragma pack()
#endif

enum ltCmdEnumList
{
    ltCmdEnum_rwSn,
    ltCmdEnum_rwAddr,
    ltCmdEnum_getInf,
    ltCmdEnum_heartBeat,
};
#if LT_PTC_CMD_SUB_ENABLE
void ltCmdSubDealByID(ltPtcParseStc *ptcptr);
#endif
#if LT_PTC_CMD_HOST_ENABLE
int ltCmdHostDealByID(ltPtcParseStc *ptcptr);
#endif
#endif